package com.run.runbbs.service.impl;

import com.run.runbbs.dao.UserMapper;
import com.run.runbbs.entity.User;
import com.run.runbbs.util.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserService implements Constant {
    @Autowired
    private UserMapper userMapper;


    public User findUserById(int id){
        return userMapper.selectById(id);
    }
    public User findSimpleUserById(int id){
        return userMapper.selectSimpleUserById(id);
    }
    public User findUserByName(String username){
        return userMapper.selectByName(username);
    }
    public User findUserByEmail(String email){
        return userMapper.selectByEmail(email);
    }
    public int addUser(User user){
        userMapper.insertUser(user);
        return user.getId();
    }
    public int updateHeader(int userId,String headerUrl){
        return userMapper.updateHeader(userId,headerUrl);
    }
    public int updatePassword(int userId,String password){
        return userMapper.updatePassword(userId,password);
    }

}
